package com.xiaomili.halfsugar.app;

import android.app.Application;
import android.util.DisplayMetrics;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

/**
 * Created by Administrator on 2016/7/4.
 */
public class IApp extends Application{
    public static int mScreenWidth;
    public static int mScreenHeight;
    @Override
    public void onCreate() {
        super.onCreate();
        initImageLoader();
        initScreenSize();
    }


    private void initImageLoader() {
        ImageLoaderConfiguration config=new ImageLoaderConfiguration.Builder(this)
                .diskCacheSize(30*1024*1024)
                .memoryCacheSize(10*1024*1024)
                .build();
        ImageLoader.getInstance().init(config);
        //或者使用系统默认的配置
//        ImageLoader.getInstance().init(ImageLoaderConfiguration.createDefault(this));
    }
    //获取屏幕宽高
    private void initScreenSize() {
        DisplayMetrics dm= new DisplayMetrics();
        mScreenWidth=dm.widthPixels;
        mScreenHeight=dm.heightPixels;
    }
}
